import api from '../../api';
import { message } from 'antd';
export default {
  namespace: 'operationM',

  state: {},
  effects: {
    //跑批数据监控
    *getProductData({ payload, callback }, { call, put }) {
      const response = yield call(api.operation.getProductData, payload);
      if (response && response.code === 0) {
        callback('success', response.data);
      } else {
        callback('fail');
        message.error('获取跑批数据监控失败，请联系管理员修复。');
        console.error(`获取跑批数据监控失败，失败原因：${response?.msg}`, '接口名称：getInfo 接口：tableDataController/getInfo');
      }
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
